# uncompyle6 version 3.2.3
# Python bytecode 3.6 (3379)
# Decompiled from: Python 3.6.8 |Anaconda custom (64-bit)| (default, Feb 21 2019, 18:30:04) [MSC v.1916 64 bit (AMD64)]
# Embedded file name: helpers\issue_tracker\clients\client.py
from .jira_client import JiraClient
from .github_client import GithubClient
from .tfs_client import TFSClient
from .util import trim_trailing_character


def get_client(target_config, proxies_cb=None, ssl_ca_bundle_path=True):
    """
    Note that instead of platform being passed, you can pass
    scan target config which is first parsed, then
    assigned to a specific platform. This allows WVS to not
    have to add any additional logic to evaluate the platform.
    
    :Example:
    
    def get_client(config):
        platform = parse_provider(config)
        base_url = parse_baseurl(config)
        ...
    
    client.get_client(target_config)
    client.add_vulnerability(vuln_details)
    
    :param target_config: Scan Target configuration containing all target
                            related data (e.g. base URL)
    
    :param proxies_cb: callback function for pulling current requests proxies
    :param ssl_ca_bundle_path: enables/disables ssl certificate verification, useful when using proxies
    
    :return: Issue Tracker client
    
    """
    target_config["url"] = trim_trailing_character(target_config["url"])
    platform = target_config["bug_tracker"].lower()
    try:
        if platform == "jira":
            return JiraClient(
                target_config,
                proxies_cb=proxies_cb,
                ssl_ca_bundle_path=ssl_ca_bundle_path,
            )
        if platform == "github":
            return GithubClient(
                target_config,
                proxies_cb=proxies_cb,
                ssl_ca_bundle_path=ssl_ca_bundle_path,
            )
        if platform == "tfs":
            return TFSClient(
                target_config,
                proxies_cb=proxies_cb,
                ssl_ca_bundle_path=ssl_ca_bundle_path,
            )
        raise ValueError("Unknown platform passed")
    except AttributeError:
        raise AssertionError("Incorrect type for platform, must be str")
